﻿@model XPressify.Models.PostponedListModel
@using XPressify.Data.Helpers

@if(Model.IsAjaxRequest)
{
        ViewBag.Title = "Requsted list";
}
else
{
        ViewBag.Title = "Requsted list";
        Layout = "~/Views/Shared/_Layout.cshtml";
}


<script type="text/javascript">


    function success() {

    }

    $(function () {
        $("#tabs").tabs({
            ajaxOptions: {
                error: function (xhr, status, index, anchor) {
                    $(anchor.hash).html(
						"Couldn't load this tab.");
                }
            }
        });
    });


    $(document).ready(function () {
        $("#maincol").css('padding', '0px');
        $('#ui-tabs-1').css('font', '13px "Trebuchet MS", Verdana, Helvetica, sans-serif');
        $('#ui-tabs-2').css('font', '13px "Trebuchet MS", Verdana, Helvetica, sans-serif');
        $('#ui-tabs-3').css('font', '13px "Trebuchet MS", Verdana, Helvetica, sans-serif');
    });


</script>





@if(!Model.IsAjaxRequest)
{
    <div id="tabs">
    <ul>
	    <li><a href="/Profile/RequestedList">Requested</a></li>
	    <li><a href="/Profile/PostponedList">Postponed</a></li>
	    <li><a href="/Profile/BlockedList">Blocked</a></li>
    </ul>
    </div>
}




@if (Model.IsAjaxRequest)
{
<div id="mySpecialList">

<table>
    <tr>
        <th style="width:300px">
            Name
        </th>
        <th>
            Type
        </th>
        <th></th>
        <th></th>
    </tr>

@foreach (var item in Model.Users)
{
    <tr>
        <td>
            @if (item.BaseSubjectType == SubjectType.User)
            {
                @Html.ActionLink(item.Name, "ProfileView", "Profile", new { id = item.Id }, new { @class = "nobtn" , style="color:blue"})
            }
            else if (item.BaseSubjectType == SubjectType.Event)
            {
                @Html.ActionLink(item.Name, "EventDetails", "Event", new { id = item.Id }, new { @class = "nobtn", style = "color:blue" })
            }
            else if (item.BaseSubjectType == SubjectType.Group)
            {
                @Html.ActionLink(item.Name, "GroupDetails", "Group", new { id = item.Id }, new { @class = "nobtn" , style="color:blue"})
            }
            else if (item.BaseSubjectType == SubjectType.Page)
            {
                @Html.ActionLink(item.Name, "PageDetails", "Page", new { id = item.Id }, new { @class = "nobtn" , style="color:blue"})
            }
        </td>
        <td>
            @if (item.RelationshipType != RelationshipType.AdministratorOf)
            {
                @item.Type   
            }
            else
            {
                @:become administrator
            }
        </td>
        <td style="text-align:right">
            @if (item.RelationshipType != RelationshipType.AdministratorOf)
            {
                @Html.ActionLink("Confirm", "ConfirmRelationship", "Profile", new { id = item.RelationshipId }, new { })
            }
            else
            {
                @Html.ActionLink("Confirm", "ConfirmAdminRelationship", "Profile", new { id = item.RelationshipId }, new { })
            }
        </td>
        <td style="text-align:right">
            @Html.ActionLink("Postpone", "PostponeRelationship", "Profile", new { id = item.RelationshipId }, new { })
        </td>
    </tr>
}

</table>

</div>
    
}